package chamber.n02.factorial;

import static com.google.common.base.Preconditions.checkArgument;

/**
 * Created by Gerardo on 2/3/14.
 */
public class FactorialIterative implements Factorial {
	@Override
	public Long apply(final Long input) {
		checkArgument(input > 0, "input must be positive");

		Long result = 1L;
		for (long i = 1; i <= input; i++) {
			result *= i;
		}
		return result;
	}
}
